<template>
  <el-form-item v-show="isShow" :label="i18nt('designer.setting.align')">
    <el-select v-model="optionModel.align" :disabled="disabled">
      <el-option
        v-for="option in options"
        :key="option.value"
        :label="option.label"
        :value="option.value"
      >
      </el-option>
    </el-select>
  </el-form-item>
</template>

<script>
import { ALIGN_TYPE } from '@/designer/const'

export default {
  name: 'AlignEditor',
  props: {
    designer: Object,
    selectedWidget: Object,
    optionModel: Object,
    disabled: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      options: [
        {
          label: '左对齐',
          value: ALIGN_TYPE.LV_ALIGN_LEFT_MID
        },
        {
          label: '居中',
          value: ALIGN_TYPE.LV_ALIGN_CENTER
        },
        {
          label: '右对齐',
          value: ALIGN_TYPE.LV_ALIGN_RIGHT_MID
        }
      ]
    }
  },
  computed: {
    isShow() {
      // 当组件为 number , 并且 type 为 modbus 时，不显示
      if (this.selectedWidget && this.selectedWidget.type === 'number') {
        return false
      }

      return true
    }
  }
}
</script>

<style lang="scss" scoped>
.radio-group-custom {
  :deep(.el-radio-button__inner) {
    padding-left: 12px;
    padding-right: 12px;
  }
}
</style>
